package com.ruc.dbiir.rest.utils;

import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class OracleJdbcTest {

	public static void main(String[] args) {
		String driver = "oracle.jdbc.driver.OracleDriver";
		String url = "jdbc:Oracle:thin:@192.168.8.2:1521:orcl";
		Statement stmt = null;
		ResultSet res = null;
		Connection conn = null;
		CallableStatement proc = null;
		String sql = " select * from t_item where rownum < 10";
		try {
			Class.forName(driver);
			conn = DriverManager.getConnection(url, "zdyf", "zdyf");
			stmt = conn.createStatement();
			res = stmt.executeQuery(sql);
			while(res.next())
			{
				String plm_m_oid = res.getString("PLM_M_OID");
				String plm_i_name = res.getString("PLM_I_NAME");
				String plm_cailiao = res.getString("PLM_CAILIAO");
				String plm_wllx = res.getString("PLM_WLLX");
				String plm_wlly = res.getString("PLM_WLLY");
				System.out.println(plm_m_oid+" "+plm_i_name+" "+plm_cailiao+" "+plm_wllx);
			}
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
